interface Params{
    data:Array<any>
    //fn:(...args: any)=>any
}

const workercode = () => {
    const  fn=(a:number,b:never)=>a+b
    const doSomething = ({data}:Params) => {
      // do something with data
      //const res = fn(...data)
      console.log({data})
      
      return data;
    };
    self.onmessage = function (e) {
      const res = doSomething(e.data);
      self.postMessage(res);
    };
  };

  let code = workercode.toString();
  code = code.substring(code.indexOf("{") + 1, code.lastIndexOf("}"));

  const blob = new Blob([code], { type: "application/javascript" });
  const worker_script = URL.createObjectURL(blob);

  export default worker_script;
